//
//  ContactCell.m
//  NetPhone
//
//  Created by intel intel on 12-4-26.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "ContactCell.h"

@implementation ContactCell
@synthesize contact;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        UIImageView *back = [[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 39)]autorelease];
        back.image = [UIImage imageNamed:@"numlist_result_bg"];
        self.backgroundView = back;
       // [self.contentView addSubview:back];
        
        //self.backgroundView = [[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 390)]autorelease]
        
        
        UIImageView *icon = [[[UIImageView alloc]initWithFrame:CGRectMake(2, 2, 35, 35)]autorelease];
        icon.image = [UIImage imageNamed:@"contacts"];
        [self.contentView addSubview:icon];
        
        nameLabel = [[[UILabel alloc]initWithFrame:CGRectMake(40, 0, 150, 39)]autorelease];
        nameLabel.font = [UIFont systemFontOfSize:14];
        nameLabel.textColor = [UIColor blackColor];
        nameLabel.backgroundColor = [UIColor clearColor];
        [self.contentView addSubview:nameLabel];
        
        UIImageView *call = [[[UIImageView alloc]initWithFrame:CGRectMake(190, 12, 13, 15)]autorelease];
        call.image = [UIImage imageNamed:@"symbol_call"];
        [self.contentView addSubview:call];
        
        phoneLabel = [[[UILabel alloc]initWithFrame:CGRectMake(205, 0, 100, 39)]autorelease];
        phoneLabel.font = [UIFont systemFontOfSize:14];
        phoneLabel.textColor = [UIColor blackColor];
        phoneLabel.backgroundColor = [UIColor clearColor];
        [self.contentView addSubview:phoneLabel];
    }
    return self;
}

-(void)setContact:(Contact *)_contact
{
    if (_contact != contact) {
        [contact release];
        contact = [_contact retain];
    }
    
    nameLabel.text = contact.name;
    phoneLabel.text = contact.phone;
    
}

-(void)dealloc
{
    [contact release];
    [super dealloc];
}

@end
